package com.qf.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.pojo.PatientPojo;
import org.apache.ibatis.annotations.*;

import java.sql.Timestamp;
import java.util.List;

@Mapper
public interface PatientMapper extends BaseMapper<PatientPojo> {
    @Select("select * from patient ${ew.customSqlSegment}")
    @Results(id = "base", value = {
            @Result(column = "patient_id", property = "patientId", id = true),
            @Result(column = "user_id", property = "userId"),
            @Result(column = "patient_name", property = "patientName"),
            @Result(column = "patient_sex", property = "patientSex"),
            @Result(column = "patient_age", property = "patientAge"),
            @Result(column = "patient_tel", property = "patientTel"),
            @Result(column = "patient_status", property = "patientStatus"),
            @Result(column = "patient_date", property = "patientDate"),
            @Result(column = "patient_remark", property = "patientRemark"),
            @Result(column = "patient_items", property = "patientItems"),
            @Result(column = "patient_card", property = "patientCard"),
            @Result(column = "user_id", property = "user", one = @One(select = "com.qf.mapper.UserMapper.findOne"))
    })
        //many = @Many(select = "com.qf.mapper.UserMapper.findOne")
        //one = @One(select = "com.qf.mapper.UserMapper.findOne")
//    List<PatientPojo> findAll(Integer start, Integer pageSize,Integer isDelete);
    Page<PatientPojo> findAll(Page<PatientPojo> page, @Param(Constants.WRAPPER) Wrapper<PatientPojo> wrapper);
}
